#ifndef GRIDSPLITTER_H
#define GRIDSPLITTER_H
#include "StompedReality/math/Vector2.h"
#include "StomperLib/ToolElement.h"
#include <vector>
namespace PatchStomper
{
class GridSplitter : public StomperLib::ToolElement
{
 public:

  // Con-/Destructor
  GridSplitter( StomperLib::BaseLayout* layout, StompedReality::IGame* game, StomperLib::EditorCamera* camera );
  ~GridSplitter( );

  // Getter
  StompedReality::Math::Vector2 BaseSize( );
  StompedReality::Math::Vector2 GetRectPos( const StompedReality::Math::Vector2 point );
  bool IsPointInsideRect( const StompedReality::Math::Vector2 point );

  // ToolElement implementations
  void Draw( );
  bool Update( );

  // Callbacks

  void OnTextureChange( );

 private:

  // Events
  void OnXChange( Gwen::Event::Info info );
  void OnYChange( Gwen::Event::Info info );
  void OnOffSetXChange( Gwen::Event::Info info );
  void OnOffSetYChange( Gwen::Event::Info info );
  void OnActivateChange( Gwen::Event::Info info );

  // private functions
  void CalculateRects( );
  void CreateGui( StomperLib::BaseLayout* layout );

 private:

  int m_SplitX;
  int m_SplitY;
  int m_OffsetX;
  int m_OffsetY;
  StompedReality::Math::Vector2 m_BaseSize;
  std::vector<StompedReality::Math::Vector2> m_PositionList;

};

}
#endif // ifndef GRIDSPLITTER_H